package com.zenq.ssm.web.ctrl;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/hello")
public class HelloController {

	@RequestMapping("/world")
	public String hello() {
		return "success";
	}
	
	@RequestMapping("/login")
	public String login(@RequestParam String uname, @RequestParam String pwd) {
		System.out.println("username="+uname);
		System.out.println("pwd="+pwd);
		return "success";
	}
	
	@RequestMapping("/redirect1")
	public String red1() {
		return "redirect:/redirect.jsp";
	}
	
	@RequestMapping("/redirect2")
	public ModelAndView red2() {
		ModelAndView mav = new ModelAndView();
		mav.setViewName("redirect:/redirect.jsp");
		return mav;
	}
	
	@RequestMapping("/redirect3")
	public ModelAndView red3() {
		ModelAndView mav = new ModelAndView();
		mav.setViewName("redirect:http://www.baidu.com");
		return mav;
	}
}
